<?php
   header("Content-type:text/html;charset=utf-8");

   $mysqli = new mysqli("localhost","root","root","sten");

   // echo $mysqli->connect_errno;
   $sql = "select * from datas";
   $res = $mysqli->query($sql);
  for ($i = 0; $i < $res->num_rows;$i++){
    $data[] = $res->fetch_assoc();
  }
  print_r(json_encode($data));
?>